def writeFile():
    bf = open('b1','tw')
    strings = 'abcdefghijklmnopqrstuvwxyz'
    bf.write(strings)
    #bf.seek()
    #bf.write()
    bf.close()
def readFile():
    bf = open('b1','tr')
    #bf.seek(100)
    strings = bf.read()    
    #print(bf.tell())
    print(strings)
    bf.close()
def readBinFile():
    bf = open('b1','br')
    blocks = bf.read()   
    showbytes(blocks)
    print(blocks)
    bf.close()
def showbytes(b):
    print(b)
    print('----------------')
    for i in b:
        print('\\x{:x}'.format(i),end='')
    print('\n')
        
if __name__ == '__main__':
    writeFile()
    readBinFile()
    readFile()
